package com.fqy.thread.ticket02;

/**
 * User: fqy
 * Date: 2021/8/31
 * Time: 12:05
 * Describe: lambda表达式
 */
public class TicketSale {
    public static void main(String[] args)//一切程序的入口
    {
        Ticket ticket = new Ticket();

        //Thread(Runnable target, String name) Allocates a new Thread object.
        /*new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                for (int i = 0; i < 51; i++) {
                    ticket.sale();
                }
            }
        }, "A").start();

        new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                for (int i = 0; i < 51; i++) {
                    ticket.sale();
                }
            }
        }, "B").start();

        new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                for (int i = 0; i < 51; i++) {
                    ticket.sale();
                }
            }
        }, "C").start();*/


        new Thread(() -> { for (int i = 0; i < 51; i++) ticket.sale(); },"A").start();
        new Thread(() -> { for (int i = 0; i < 51; i++) ticket.sale(); },"B").start();
        new Thread(() -> { for (int i = 0; i < 51; i++) ticket.sale(); },"C").start();
    }
}
